package com.zmm.myyimixian.ui.factory;

import android.support.v4.app.Fragment;
import android.util.SparseArray;

import com.zmm.myyimixian.ui.activity.main.dingdan.child.MeDingDanFragment;
import com.zmm.myyimixian.ui.activity.main.dingdan.child.MeTuanDanFragment;

/**
 * Created by Administrator on 2016/10/23 0023.
 * 生产Fragment的工厂
 */

public class FragmentFactory {
    public static final String [] DINGDAN_TITLES = {"我的订单","我的团单"};
    private static final int FRAGMENT_DING_DAN = 0;
    private static final int FRAGMENT_TUAN_DAN= 1;
    private static SparseArray<Fragment> dingDanFragments = new SparseArray<>();
    //贡献榜的创建工厂方法
    public static Fragment cerateDingDanFragment(int index){
        Fragment fragment = dingDanFragments.get(index);
        if (fragment == null){
            switch (index) {
                case FRAGMENT_DING_DAN:
                    fragment = new MeDingDanFragment();
                    break;
                case FRAGMENT_TUAN_DAN:
                    fragment = new MeTuanDanFragment();
                    break;
            }
        }
        return fragment;
    }
}
